package com.xb.mainactivity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void sendMessage(View view){
        //按钮的响应事件
        EditText msg =findViewById(R.id.message);
        String s = msg.getText().toString();
        /*Log.i("mainActivity",s);
        Log.d("mainActivity",s);
        Log.e("mainActivity",s);
        Log.w("mainActivity",s);*/

        //1.显式的启动，class跳转
        /*Intent intent=new Intent(this,SecondActivity.class);
        this.startActivity(intent);*/

        //2.显式的启动，包名.类名
        /*Intent intent=new Intent();
        intent.setClassName(this,"com.xb.mainactivity.SecondActivity");
        this.startActivity(intent);*/


        //3.显式的启动，ComponentName
        /*Intent intent=new Intent();
        ComponentName cname=new ComponentName(this,SecondActivity.class);
        intent.setComponent(cname);
        this.startActivity(intent);*/

        //4.隐式启动：在配置文件中配置名称
        /*Intent intent=new Intent();
        intent.setAction("action.nextActivity");
        this.startActivity(intent);*/

        Intent intent=new Intent("action.nextActivity");
        this.startActivity(intent);

        //在配置文件中，两个Activity的名称一样时，由用户来选择使用哪个应用程序



    }
}
